//
// Created by DengLibin on 2018/12/11 0011.
//
#include <iostream>
#include <sstream>
using namespace std;
/**
 *结构体
 */
 struct  TeacherStruct
 {
 private:
     string name;
     int age;
     int gender = 1;
     string toStringResult;
 public:
        TeacherStruct(string & name, int age, int gender = 0 )
        {
            this->name = name;
            this->age = age;
            this->gender = gender;
        }
        string & to_string()
        {
            std::stringstream ss;
            ss << name;
            ss << ",";
            ss << age;
            ss << ",";
            ss << gender;
            ss >> toStringResult;
            return toStringResult;
        }
 };

 int main10()
 {
     string name ="张XX";
     TeacherStruct teacherStruct = {name, 10,1};
     TeacherStruct * p = new TeacherStruct(name, 10,1);
     cout << teacherStruct.to_string()<<endl;
     cout << p->to_string()<<endl;
     delete p;
     return 0;
 }
